//
//  MainHomePageSpeedSubView.swift
//  FrameProduct
//
//  Created by delegate on 2025/10/20.
//

import UIKit

class MainHomePageSpeedSubView: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
        
    }
    
    private func setupUI() {
        addSubviews(iconBgImageView, titleLabel)
        iconBgImageView.addSubview(iconImageView)
        iconBgImageView.snp.makeConstraints { make in
            make.top.equalTo(0)
            make.centerX.equalToSuperview()
            make.width.height.equalTo(26)
        }
        iconImageView.snp.makeConstraints { make in
            make.centerX.centerY.equalToSuperview()
            make.width.equalTo(16)
            make.height.equalTo(16)
        }
        titleLabel.snp.makeConstraints { make in
            make.left.right.equalToSuperview()
            make.top.equalTo(iconBgImageView.snp.bottom).offset(5)
            make.bottom.equalToSuperview()
        }
    }
    func setIconImage(iconName: String, title: String) {
        iconImageView.image = UIImage(named: iconName)
        titleLabel.text = title
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //=================================================================
    //                            lazy
    //=================================================================
    // MARK: - lazy
    private lazy var iconBgImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "circle")
        return imageView
    }()
    private lazy var iconImageView: UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()
    private lazy var titleLabel: UILabel = {
        let label = UILabel(frame: .zero)
        label.text = "10"
        label.textColor = .lxs.hex("#BAE0FF")
        label.font = .lxs.font(size: 12)
        label.textAlignment = .center
        return label
    }()
}
